#!/usr/bin/env pytho
# -*- coding: utf-8 -*-
import requests
import json
url = "http://172.16.1.188:8080/api/manage_member/user/auth/login" # 接口地址

payload = {
'password': '11111111',
'username': 'chengyaunzizhanghao0008',
'uuid': '',
'verifyCode': '',
}
r = requests.post(url, json=payload, verify=False)
# print(r.text)
token = json.loads(r.text)["token"] #获取登录后的token
print(token)

urlcy ="http://172.16.1.21/xl-dcs/api/manage_member/uncredit_information/credit_record" #成员单位发布失信

data={
	"enterpriseNamea": "",
	"enterpriseName": "烟台铁建路桥建设发展有限公司" , #* 企业名称
	"uniformSocialCreditCode": "81210211MA0YK41P97",  #* 社会统一代码
	"registerNo": "",  # 注册号
	"name": "王大拿",			#代表人
	"identityType": 135,  #[135到139 ]
	"identityNo": "153201199512275289", #身份证号码
	"disCreditField": "109",  #失信领域[102到103 其他142]
	"debitMoney": "3000",  #*欠款金额
	"conditionDeclare": "2010年7月1号该公司欠款500万元中星龙建设工程（海南）有限公司，应付款6000元特此情况说明",
	"occurTime": "2012-06-30T16:00:00.000Z", #发生时间
	"penaltyMeasureIdList": [228, 235],    #惩戒措施id集合
	"publishType": 9, #失信类型 {9债务,10行为}
	"publishName": 0,  #类型 {9,0法人,1自然人   10,0,1}
	}

data1=json.dumps(data)

headers = {"Accept"	:"application/json, text/plain, */*",
"Accept-Encoding"	:"gzip, deflate",
"Accept-Language"	:"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Authorization"	: token,
"Connection"	:"keep-alive",
"Content-Length"	:"561",
"Content-Type"	:"application/json",
"Host"	:"172.16.1.21",
"Referer"	:"http://172.16.1.21/loginTo/homepage",
"User-Agent"	:"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36"}


r2 = requests.post(url=urlcy, data=data1, headers=headers)

print(r2.status_code)
print(r2.text)
